package org.stragma.apply.util

import org.stragma.apply.signatures.Apply._

/*
 * This object consists of some of the math function used in Apply
 */
object Math {	
	/*
	 * Subtract the value of two Int terms
	 */
	def subtS(arg0 : Int, arg1 : Int) = {
		val i = arg0.arg0.toInt
		val j = arg1.arg0.toInt
		Int((i - j).toString)
	}
	
	/*
	 * Find the modulus of two Int terms
	 */
	def modS(arg0 : Int, arg1 : Int) = {
		val i = arg0.arg0.toInt
		val j = arg1.arg0.toInt
		Int((i % j).toString)
	}
	
	/*
	 * Multiply the value of two Int terms
	 */
	def mulS(arg0 : Int, arg1 : Int) = {
		val i = arg0.arg0.toInt
		val j = arg1.arg0.toInt
		Int((i * j).toString)
	}
	
	/*
	 * Divide two integers returning the result as a term
	 */
	def divS(arg0 : Int, arg1 : Int) = {
		val i = arg0.arg0.toInt
		val j = arg1.arg0.toInt
		Int((i / j).toString)
	}
	
	/*
	 * Add the integer value of two terms
	 */
	def addS(arg0 : Int, arg1 : Int) = {
		val i = arg0.arg0.toInt
		val j = arg1.arg0.toInt
		Int((i + j).toString)
	}
}